package com.music.controller;

import com.music.common.BaseResult;
import com.music.service.CmMusicService;
import com.music.service.MusicSingerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 2 * @Author: 刘佳乐 :面向百度编程
 * 3 * @Date: 2020/12/17 16:51
 * 4
 */
@RestController
@RequestMapping("music")
//@CrossOrigin
public class CmMusicController {

    @Autowired
    CmMusicService cmMusicService;
    @Autowired
    MusicSingerService musicSingerService;

    @RequestMapping(value = "findBymId",method = RequestMethod.POST)
    public BaseResult findBymId(@RequestBody Map map){
        return cmMusicService.findById((Integer) map.get("mId"));
    }

    @RequestMapping(value = "findMusicAndsName",method = RequestMethod.POST)
    public BaseResult findMusicAndsName(@RequestBody Map map){
        return musicSingerService.findMusicAndsName((Integer) map.get("mId"));
    }

    @RequestMapping(value = "likesearch",method = RequestMethod.POST)
    public BaseResult likesearch(@RequestBody Map map){
        return musicSingerService.likesearch(map.get("searchpoint").toString());
    }
}
